<?php

/**
 * Copyright (C) 2007 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     @license http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

$currentDir = dirname(__FILE__);
require_once($currentDir . "/sensapilityservice.php");
require_once($currentDir . "/utilities.php");

/**
 * @author api.jmatt@gmail.com
 * @version 0.1
 */

class SensapilityReferral extends SensapilityService {

  /**
   * @param soapclientnusoap $soapClient the NuSOAP object that communicates 
   * with the service
   * @param array $namespaces associative array that matches namespace labels
   * to namespace URIs
   * @param array $defaultNamespaceLabel the namespace to be used with most
   * tags
   * @return none
   */
  function SensapilityReferral($soapClient, 
                               $namespaces,
                               $defaultNamespaceLabel) {
    parent::SensapilityService($soapClient, 
                               $namespaces,
                               $defaultNamespaceLabel);
  }

  /**
   * @param string $serviceId the id for the referral service for this
   * publisher
   * @param string $locale the Google-supported locale that this referral 
   * will appear in
   * @param string $referralType the product for which this referral should
   * be for
   * @return string the HTML code for the referral
   */
  function getReferralData($serviceId, $locale, $referralType) {
    $ns = $this->defaultNamespaceLabel;
    $returnValue = null;
    $callParameters = array($ns . ':synServiceId' => $serviceId,
                            $ns . ':locale' => $locale,
                            $ns . ':referralType' => $referralType);


    return parent::doSoapCall('getReferralData',
                              ArrayToXml($callParameters),
                              $this->__soapClient->namespaces[$ns],
                              true,
                              1,
                              true);
  }
}
?>
